package cn.ljw.common;

import java.io.File;
import java.util.Map;

/**
 * @author 一朝风月
 * @date 2024/3/27 18:57
 * @Code 面向注解面向卿，终无解释再无你
 * @description 常量工具类
 */
public interface FameConst {
    //MD5加密
    String MD5_SLAT="weiloujiaxihhhtmj1321ec";
    String DEFAULT_PAGE="1";
    String DEFAULT_SIZE="10";//1:10 ok
    Integer MAX_TITLE_COUNT = 255;//评论
    Integer MAX_CONTENT_COUNT = 200000;//字数>
    Integer MAX_SUMMARY_COUNT = 255;
    String DEFAULT_SUMMARY_FLAG = "<!--read more-->";
    int MAX_COMMENT_CONTENT_COUNT = 1023;
    int MAX_COMMENT_NAME_COUNT = 255;
    int MAX_COMMENT_EMAIL_COUNT = 255;
    int MAX_COMMENT_WEBSITE_COUNT = 255;
    String DEFAULT_EMAIL_TEMPLATE_SUBJECT = "来自CapBlog博客网站发送的邮件";
    //发送给管理员的邮件
    static String getEmailTemplateAdminContent(Map<String, String> params) {
        String emptyString = "";
        String websiteName = params.getOrDefault("websiteName", emptyString);
        String name = params.getOrDefault("name", emptyString);
        String content = params.getOrDefault("content", emptyString);
        String website = params.getOrDefault("website", emptyString);
        String articleId = params.getOrDefault("articleId", emptyString);

        return "<!DOCTYPE html>" +
                "<html>" +
                "<head>" +
                "<meta charset=\"UTF-8\">" +
                "<title>" + websiteName + " Email</title>" +
                "</head>" +
                "<body>" +
                "<h3>" + websiteName + "有新的评论回复</h3>" +
                "<p>来自" + name + "的评论：" + content + "</p>" +
                "<br>" +
                "<a href=\"" + website + "article/" + articleId + "\">查看详情</a>" +
                "</body>" +
                "</html>";
    }//回复模板
    static String getEmailTemplateUserContent(Map<String, String> params) {
        String emptyString = "";
        String websiteName = params.getOrDefault("websiteName", emptyString);
        String name = params.getOrDefault("name", emptyString);
        String content = params.getOrDefault("content", emptyString);
        String website = params.getOrDefault("website", emptyString);
        String articleId = params.getOrDefault("articleId", emptyString);

        return "<!DOCTYPE html>" +
                "<html>" +
                "<head>" +
                "    <meta charset=\"UTF-8\">" +
                "    <title>" + websiteName + " Email</title>" +
                "</head>" +
                "<body>" +
                "<h3>你在" + websiteName + "的评论有人回复了,快去查看吧!</h3>" +
                "<p>来自" + name + "的评论：" + content + "</p>" +
                "<br>" +
                "<a href=\"" + website + "article/" + articleId + "\">查看详情</a>" +
                "</body>" +
                "</html>";
    }
    String FAME_HOME = ".capblog" + File.separator;
    String USER_HOME = System.getProperties().getProperty("user.home") + File.separator;
    String UPLOAD_DIR = "upload" + File.separator;
    String MEDIA_DIR = UPLOAD_DIR + "media" + File.separator;
    String BACKUP_DIR = UPLOAD_DIR + "backup" + File.separator;
    String MEDIA_THUMBNAIL_SUFFIX = "_thumbnail";
    String MARKDOWN_SUFFIX = ".md";

}
